Skip to content

chore(profiling): install time#62

Merged
Kikobeats merged 4 commits into
masterfrom
next
May 19, 2026
Merged

chore(profiling): install time#62
Kikobeats merged 4 commits into
masterfrom
next

Conversation

@Kikobeats
Copy link
Copy Markdown
Owner

@Kikobeats Kikobeats commented May 19, 2026

Note

Low Risk
Low risk: only restructures profiling/return values around compilation and updates related tests/logging, without changing sandboxing, permissions, or execution behavior.

Overview
Refines profiling output for compilation. compile() now measures dependency install time and esbuild build time separately and returns { content, phases } instead of a raw string.

Runtime execution now consumes compiled.content and merges compiled.phases into the reported profiling.phases, recalculating spawn and simplifying debug logging. Tests were updated to assert the new install/build phase fields instead of compile.

Reviewed by Cursor Bugbot for commit b2df4b9. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Phases don't sum to total due to mixed timing sources
    • Changed spawn calculation to use compiled.install and compiled.build directly instead of installAndBuildMs, ensuring all phases use consistent timing sources and sum to total.

Create PR

Or push these changes by commenting:

@cursor push 69f5ad6318
Preview (69f5ad6318)
diff --git a/src/index.js b/src/index.js
--- a/src/index.js
+++ b/src/index.js
@@ -48,7 +48,6 @@
       try {
         total = timeSpan()
         const compiled = await compilePromise
-        const installAndBuildMs = total()
 
         const subprocess = spawn({
           args: JSON.stringify(args),
@@ -69,7 +68,7 @@
           phases: {
             install: compiled.install,
             build: compiled.build,
-            spawn: totalMs - installAndBuildMs - run,
+            spawn: totalMs - compiled.install - compiled.build - run,
             run,
             total: totalMs
           }

You can send follow-ups to the cloud agent here.

Comment thread src/index.js Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Phases property compile removed without updating type definition
    • Updated Phases interface to replace compile property with install and build properties, matching the runtime implementation, and updated tests accordingly.

Create PR

Or push these changes by commenting:

@cursor push 9bdb9c4ab0
Preview (9bdb9c4ab0)
diff --git a/src/index.d.ts b/src/index.d.ts
--- a/src/index.d.ts
+++ b/src/index.d.ts
@@ -2,8 +2,10 @@
  * Profiling information about the isolated function execution
  */
 export interface Phases {
-  /** Time waiting for compilation in milliseconds (0 if cached) */
-  compile: number
+  /** Time spent installing dependencies in milliseconds (0 if cached) */
+  install: number
+  /** Time spent building with esbuild in milliseconds */
+  build: number
   /** Process creation + Node.js boot + template setup in milliseconds */
   spawn: number
   /** User function execution time in milliseconds */

diff --git a/test/index.js b/test/index.js
--- a/test/index.js
+++ b/test/index.js
@@ -122,7 +122,8 @@
   t.is(value, undefined)
   t.is(typeof profiling.cpu, 'number')
   t.is(typeof profiling.memory, 'number')
-  t.is(typeof profiling.phases.compile, 'number')
+  t.is(typeof profiling.phases.install, 'number')
+  t.is(typeof profiling.phases.build, 'number')
   t.is(typeof profiling.phases.spawn, 'number')
   t.is(typeof profiling.phases.run, 'number')
   t.is(typeof profiling.phases.total, 'number')

diff --git a/test/index.test-d.ts b/test/index.test-d.ts
--- a/test/index.test-d.ts
+++ b/test/index.test-d.ts
@@ -100,7 +100,8 @@
 
   expectType<number>(profiling.cpu)
   expectType<number>(profiling.memory)
-  expectType<number>(profiling.phases.compile)
+  expectType<number>(profiling.phases.install)
+  expectType<number>(profiling.phases.build)
   expectType<number>(profiling.phases.spawn)
   expectType<number>(profiling.phases.run)
   expectType<number>(profiling.phases.total)

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit e373623. Configure here.

Comment thread src/index.js Outdated
@coveralls
Copy link
Copy Markdown

coveralls commented May 19, 2026

Coverage Report for CI Build 26130566187

Warning

No base build found for commit 01ffa37 on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 97.215%

Details

  • Patch coverage: 15 of 15 lines across 2 files are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 668
Covered Lines: 655
Line Coverage: 98.05%
Relevant Branches: 122
Covered Branches: 113
Branch Coverage: 92.62%
Branches in Coverage %: Yes
Coverage Strength: 48.33 hits per line

💛 - Coveralls

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 26130165510

Warning

No base build found for commit 01ffa37 on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 97.219%

Details

  • Patch coverage: 16 of 16 lines across 2 files are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 669
Covered Lines: 656
Line Coverage: 98.06%
Relevant Branches: 122
Covered Branches: 113
Branch Coverage: 92.62%
Branches in Coverage %: Yes
Coverage Strength: 48.35 hits per line

💛 - Coveralls

@Kikobeats Kikobeats merged commit 5b87b59 into master May 19, 2026
3 checks passed
@Kikobeats Kikobeats deleted the next branch May 19, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants